|
|
On Fri, 23 Apr 1999 21:48:09 +0200, ingo <ing### [at] ingodemonnl> wrote:
>To get an idea of what I'm trying run the included
Okay, so now I'm assuming you've just read my tutorial on patches.
Here's the result of the tutorial as applied to your scene. Take
note of the comments I've added.
#version 3.1;
global_settings{assumed_gamma 1.0}
light_source{<500,500,-500> rgb 1}
camera{
location<0.0,3.5,-5.0>
look_at<0.0,1.0, 0.0>
}
#macro GetRadius(R)
#local Range=R*0.1;
#local Variation=Range+((-Range)-Range)*rand(S);
#declare Rr=R+Variation;
#end
#macro BuildArray(H,R,NrBPH,NrBPC)
// H= height; R= radius
// NrBPH= number of patches in height
// NrBPC= number of patches in circumference
#local PH=((NrBPH*4)-NrBPH)+1;
#local PC=((NrBPC*4)-NrBPC)+1;
#local Ystep=H/PH;
// need one extra element in the array for C1 continuity.
#local BP_arr=array[PH+1][PC+1]
#local Ypos=0;
#local I=0;
#local J=0;
#while (I<PH+1)
#while (J<PC-1)
#local Phi=J*(360/PC);
GetRadius (R)
#declare BP_arr[I][J]=vrotate(<Rr,Ypos,0>,<0,Phi,0>);
#local J=J+1;
#end
// closed shape so last point is first point.
#local BP_arr[I][J]= BP_arr[I][0];
// the last-plus-one point must be the same as the second point, too.
#local BP_arr[I][J+1]= BP_arr[I][1];
#local J=0;
#local Ypos=Ypos+Ystep;
#local I=I+1;
#end
#declare OutArray= BP_arr
#end
#macro BuildPatch(InArray)
// the arrays were made an element larger, so here we must compensate.
#local PH= dimension_size (InArray,1)-1;
#local PC= dimension_size (InArray,2)-1;
#local I= 0;
#local J= 0;
#while (I<PH-1)
#while (J<PC-1)
bicubic_patch {
type 1
u_steps 4
v_steps 4,
InArray[I][J],InArray[I][J+1],
// notice that the third point in each row is constrained such
// that it, the last point in the row, and the second point
// in the equivalent row in the next patch are in a straight line.
2*InArray[I][J+3]-InArray[I][J+4],InArray[I][J+3],
InArray[I+1][J],InArray[I+1][J+1],
2*InArray[I+1][J+3]-InArray[I+1][J+4],InArray[I+1][J+3],
// notice, too, that each point in the entire third row is
// constrained in this way with respect to the last row and
// to the second row of the next patch. Note the lack of any
// +2 terms in the whole patch definition. We calculated them
// above, but we never use them because we no longer have as
// much freedom as we did before we wanted smoothness.
2*InArray[I+3][J]-InArray[I+4][J],
2*InArray[I+3][J+1]-InArray[I+4][J+1],
2*(2*InArray[I+3][J+3]-InArray[I+4][J+3])-
(2*InArray[I+3][J+4]-InArray[I+4][J+4]),
2*InArray[I+3][J+3]-InArray[I+4][J+3],
InArray[I+3][J],InArray[I+3][J+1],
2*InArray[I+3][J+3]-InArray[I+3][J+4],InArray[I+3][J+3]
pigment {rgb 1}
}
#local J=J+3;
#end
#local J=0;
#local I=I+3;
#end
#end
#declare S=seed(7);
BuildArray(3,2,5,10)
BuildPatch(OutArray)
Post a reply to this message
|
|